﻿<%
'''模版引擎类
Class AshapoTemplate

	'''驱动类对象
	Private s_tpl

	'''构造
	Private Sub Class_Initialize()
	End Sub
	
	'''析构
	Private Sub Class_Terminate()
		Set s_tpl = Nothing
	End Sub

	'''初始化
	'p_dirver:驱动名
	Public Default Function Init(Byval p_dirver)
		Set s_tpl = Eval("New AshapoTemplateDriver" & p_dirver)
	End Function
	
	'''返回模板驱动原型
	Public Property Get Prototype()
		Set Prototype = s_tpl
	End Property
	
	'''设置要解析的模板路径
	'p_path:模板路径
	Public Sub SetPath(Byval p_path)
		s_tpl.SetPath(p_path)
	End Sub
	
	'''解析模板,返回处理结果
	'p_replace_dict:要进行替换的Scripting.Dictionary
	Public Function Resolve(Byval p_replace_dict)
		Dim t_key, t_str
		t_str = s_tpl.Resolve()
		For Each t_key In p_replace_dict
			t_str = Replace(t_str, t_key, p_replace_dict(t_key))
		Next
		Resolve = t_str
	End Function
	
	'''获取当前解析的文件共使用了哪些文件及每个文件的最后修改时间
	Public Property Get CacheMap()
		CacheMap = s_tpl.CacheMap
	End Property
End Class
%>